﻿#region Using Directives

    using System;

    using Csla;

    using MarketPulse.BusinessLogic.Common.Criteria;
    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    /// <summary>
    /// This class represents a collection of Branches
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.BranchFactory, MarketPulse.DataAccess.Factory", "FetchInfoList")]
    public class BranchInfoList : MarketPulseReadOnlyListBase<BranchInfoList, BranchInfo>
    {

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private BranchInfoList()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method used to get a read only list of read only branches that are associated with a particular Client (via the DataPortal client proxy)
                /// </summary>
                /// <param name="clientGUID">The Client Guid used to retrieve the visit list</param>
                /// <returns>A valid (populated) list of read only branches</returns>
                public static BranchInfoList GetByClientGUID(Guid clientGUID)
                {
                    return DataPortal.Fetch<BranchInfoList>(new SingleCriteria<Guid>(clientGUID));
                }

                /// <summary>
                /// Method used to get a read only list of read only branches that are associated with a particular Client (via the DataPortal client proxy)
                /// </summary>
                /// <param name="clientGUID">The Client Guid used to retrieve the visit list</param>
                /// <returns>A valid (populated) list of read only branches</returns>
                public static BranchInfoList GetByClientGUIDAndProfileGUIDAndDateRange(Guid clientGUID, Guid profileGUID, DateTime startDateTime, DateTime endDateTime)
                {
                    return DataPortal.Fetch<BranchInfoList>(new ClientGUIDAndProfileGUIDAndDateRangeCriteria(clientGUID, profileGUID, startDateTime, endDateTime));
                }

                /// <summary>
                /// Method used to get a read only list of read only branches that are associated with a particular Company 
                /// and Country (via the DataPortal client proxy)
                /// </summary>
                /// <param name="companyGuid">The Company Guid used to retrieve the branch list</param>
                /// <param name="countryGuid">The Country Guid used to retrieve the branch list</param>
                /// <returns>A populated read only list of read only branches</returns>
                public static BranchInfoList GetByClientGUIDAndCountryGUID(Guid? companyGuid, Guid? countryGuid)
                {
                    return DataPortal.Fetch<BranchInfoList>(new BranchCriteria(companyGuid, countryGuid));
                }

            #endregion

        #endregion
    }
}
